package com.rpframework.website.device.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.rpframework.core.BaseService;
import com.rpframework.utils.NumberUtils;
import com.rpframework.utils.Pager;
import com.rpframework.website.device.dao.IGuideDao;
import com.rpframework.website.device.domain.Convert;
import com.rpframework.website.device.domain.Guide;

@Service
public class GuideService extends BaseService{
public	@Resource IGuideDao iadao;
	
	
	public Pager<Guide> getpager(Pager<Guide> pager) {
		long startTime=System.currentTimeMillis();
		List<Guide>  list=iadao.doPager(this.packageMyBatisParam(pager));
		pager.setItemList(list);
		pager.setCostTime(System.currentTimeMillis() - startTime);
		return pager;
	}

	public boolean doSaveOrUpdate(Guide t) {
		if(NumberUtils.isValid(t.getId())){
			Guide db = iadao.select(t.getId());
			return iadao.update(t);
		}else{
			return iadao.insert(t);
		}
	}
	public Guide selectOnlyOne(int parseInt) {
		// TODO Auto-generated method stub
		return iadao.select(parseInt);
	}


	public boolean insertdo(Guide dynamic) {
		// TODO Auto-generated method stub
		return iadao.insert(dynamic);
	}


	public boolean updatewiden(Guide dynamic) {
		// TODO Auto-generated method stub
		return iadao.update(dynamic);
	}
}
